/*
 * @Descripttion: 
 * @version: 1.0
 * @Author: LiYansheng
 * @Date: 2022-05-01 14:38:54
 * @LastEditors: CoderXZ
 * @LastEditTime: 2022-05-30 23:06:12
 */
import request from '@/utils/request'

// 通过id查询某个老师信息
export function getTeacherInfo(){
    return request({
        url:'/teacher',
        method:'get',
    })
}




export function getStudentJobs(){
    return request({
        url:'/teacher/stuJobs',
        method:'get',
    })
}

// 查询
export function search(form){
    return request({
        url:'/teacher',
        method:'post',
        data:{
            "account":form.account,
            "pageIndex":1,
            "pageSize":10,
            "name":form.name,
            "subject":form.subject,
            "college":form.college,
            "school":form.school
        }
    })
}

// 添加
export function add(form){
    return request({
        url:'/teacher/add',
        method:'post',
        data:{
            "account":form.account,
            "name":form.name,
            // "password":form.password,
            "sex":form.sex,
            "office":form.office,
            "phone":form.phone,
            "subject":form.subject,
            "collegeId":form.college,
            "email":form.email,
            "idCard":form.idCard,
            "duty":form.duty,
            "avatar":form.avatar,
            "classroomList":form.classroomList
        }
    })
}

// 删除
export function del(id){
    return request({
        url:'/teacher/delete',
        method:'post',
        data:{
            id:id
        }
    })
}

// 修改
export function update(form){
    return request({
        url:'/teacher/update',
        method:'post',
        data:{
            "id":form.id,
            "account":form.account,
            "name":form.name,
            "password":form.password,
            "sex":form.sex,
            "office":form.office,
            "phone":form.phone,
            "subject":form.subject,
            "collegeId":form.college,
            "email":form.email,
            "idCard":form.idCard,
            "duty":form.duty,
            "avatar":form.avatar,
            "classroomList":form.classroomList
        }
    })
}

export function update2(form){
    return request({
        url:'/teacher/update2',
        method:'post',
        data:{
            "id":form.id,
            "name":form.name,
            "sex":form.sex,
            "office":form.office,
            "phone":form.phone,
            "email":form.email,
            "idCard":form.idCard,
        }
    })
}

// 批量删除
export function delList(ids){
    return request({
        url:'/teacher/delList',
        method:'post',
        data:{
            ids:ids
        }
    })
}

// 获取可用学校名及id
export function searchSchool(){
    return request({
        url:'/school',
        method:'get',
    })
}

// 找指定学校下的学院
export function searchCollege(id){
    return request({
        url:'/college/find',
        method:'post',
        data:{
            id:id
        }
    })
}

// 找指定学院下的专业
export function searchMajor(id){
    return request({
        url:'/major/find',
        method:'post',
        data:{
            id:id
        }
    })
}


// 找指定专业下的班级
export function searchClass(id){
    return request({
        url:'/classes/find',
        method:'post',
        data:{
            id:id
        }
    })
}
